package com.example.sourcesprng.jdk17._random;

import java.util.Random;
import java.util.random.RandomGenerator;
import java.util.random.RandomGeneratorFactory;

public class TestJDK17_Random {

    public static void main(String[] args) {
        RandomGenerator random = RandomGeneratorFactory.of("L64X128MixRandom").create();
        int randomInt = random.nextInt();
        long startTime = System.currentTimeMillis();
//        for (int i = 0; i < 1000000; i++) {
//            randomInt = random.nextInt();
//        }
//        System.out.println("生成100w个随机数耗时：" + (System.currentTimeMillis() - startTime) + "ms");

        System.out.println("------------------------------");
        Random random1 = new Random();

        startTime = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            int j = random1.nextInt();
        }
        System.out.println("生成100w个随机数耗时：" + (System.currentTimeMillis() - startTime) + "ms");



    }
}
